﻿using System;
using System.Web.UI.WebControls;
using BLL.RF.PowerTest;

public partial class ViewTest_ViewYourself_PowerTestItemViewbyID : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindPowerTestItem();
        }
    }

    private void BindPowerTestItem()
    {
        PowerTestItem testItem = new PowerTestItem();
        int id = (int)Session["ID"];
        if (id != 0)
        {
            GridView1.DataSource = testItem.GetPowerTestItemsbyID(id);
            GridView1.DataBind();
            for (int i = 0; i < GridView1.Rows.Count; i++)
            {
                if (GridView1.Rows[i].Cells[7].Text == "Fail")
                    GridView1.Rows[i].Cells[7].ForeColor = System.Drawing.Color.Red;
            }
        }
    }

    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        this.GridView1.PageIndex = e.NewPageIndex;
        BindPowerTestItem();
    }
}
